package com.example.server.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

import java.util.Date;

/**
 * @author chentao
 * @version 1.0
 * @description: TODO
 * @date 2025/3/22 下午12:24
 */
@Data
@TableName(value = "sys_server")
public class SysServer extends Model<SysServer> {

    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    //服务节点
    @TableField(value = "host")
    private String host;

    //服务端口
    @TableField(value = "port")
    private Long port;

    //开始时间
    @TableField(value = "start_time")
    private Date startTime;

    //刷新时间
    @TableField(value = "refresh_time")
    private Date refreshTime;

    //操作系统名称
    @TableField(value = "os_name")
    private String osName;

    //操作系统
    @TableField(value = "os_family")
    private String osFamily;

    //操作系统
    @TableField(value = "jvm_version")
    private String jvmVersion;

    //进程id
    @TableField(value = "process_id")
    private int processId;

    //是否主节点
    @TableField(value = "is_master")
    private boolean isMaster;

    public void recalculateFields() {
        this.refreshTime = new Date();
    }
}
